using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using DataTransferObject;
using Business;
namespace Presentation.UserControlls
{
    public partial class UC_NoTienPhat : UserControl
    {
        clsDocGiaBUS docgiaBUS = new clsDocGiaBUS();
        clsDocGiaDTO docgiaDTO = new clsDocGiaDTO();
        clsThuThuBUS ThuThuBus = new clsThuThuBUS();

        BindingSource bs = new BindingSource();
        DataTable tbl = new DataTable();
        long tongcong;
        
        public UC_NoTienPhat()
        {
            InitializeComponent();
        }

        private void UC_NoTienPhat_Load(object sender, EventArgs e)
        {
            dtngay .Text = Convert.ToString(DateTime.Now.ToShortDateString());
            btnIn.Enabled = false;
        }
        private void HienThiListView(DataTable tbl1)
        {
            ListViewItem lvwitem = new ListViewItem();
            lvwthongkedocgia.Items.Clear();
            foreach (DataRow dr in tbl1.Rows)
            {
                
               if (Convert.ToInt64(dr["TONGNO"].ToString()) > 0)
                {
                    lvwitem = new ListViewItem();
                    lvwitem.Text = dr["MATHE"].ToString();
                    lvwitem.SubItems.Add(dr["HOTEN"].ToString());
                    lvwitem.SubItems.Add(dr["GIOITINH"].ToString());
                    lvwitem.SubItems.Add(dr["TONGNO"].ToString());
                    lvwthongkedocgia.Items.Add(lvwitem);
                    tongcong += Convert.ToInt64(dr["TONGNO"].ToString());
                    
               }
            }


        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            DialogResult dlg = new DialogResult();
            dlg = DevComponents.DotNetBar.MessageBoxEx.Show("Bạn có muốn thoát không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dlg == DialogResult.Yes)
            {
                this.ParentForm.Close();

            }
        }

        private void btnIn_Click(object sender, EventArgs e)
        {
            FromInAn.FrmThongKeDocGiaNoTienPhat TKDocGiaNoTienPhat = new Presentation.FromInAn.FrmThongKeDocGiaNoTienPhat();
            TKDocGiaNoTienPhat.Show();
        }

        private void dtngay_Click(object sender, EventArgs e)
        {
            
        }

        private void btnXem_Click(object sender, EventArgs e)
        {
            btnIn.Enabled = true;
            tbl = ThuThuBus.DocGiaBUS.DanhSachDocGia();
            tongcong = 0;
            HienThiListView(tbl);
            lbltongcong.Text = Convert.ToString(tongcong);
            if (tongcong == 0)
                btnIn.Enabled = false;
        }
    }
}
